<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    window.onload = function() {
        var username = document.getElementById('username');
        username.onblur = function() {
            var uservalue = document.getElementById('username').value;
            var pwdvalue = document.getElementById('mm').value;
            var xhr = new XMLHttpRequest();
            var url = "uservalue=" + uservalue + "&pwd=" + pwdvalue
            xhr.open('post', './post.php');
            xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xhr.send(url);
            xhr.onreadystatechange = function() {
                if (xhr.readyState == 4) {
                    if (xhr.status = 200) {
                        var span = document.getElementById('span1');
                        span.innerHTML = xhr.responseText;
                    }
                }
            }

        }
    }
</script>

<body>
    <form action="">
        用户名:<input type="text" id="username" name="username">
        <span id="span1"></span><br/> 密码:
        <input type="text" name="mm" id="mm">
    </form>
</body>

</html>